package net.discard.model;

import lombok.*;
import org.hibernate.annotations.DynamicInsert;
import xyz.erupt.annotation.Erupt;
import xyz.erupt.annotation.EruptField;
import xyz.erupt.annotation.sub_erupt.Power;
import xyz.erupt.annotation.sub_field.View;
import xyz.erupt.jpa.model.BaseModel;

import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;

@Entity
@Table(name = "activity_registration")
@DynamicInsert
@Setter
@Getter
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Erupt(
        name = "活动报名",
        power = @Power(importable = true, export = true),
        orderBy = "id DESC"
)
public class ActivityRegistration extends BaseModel {

    @EruptField(
            views = @View(title = "用户id")
    )
    private long userId;

    @EruptField(
            views = @View(title = "活动id")
    )
    private long activityId;

    @EruptField(
            views = @View(title = "报名状态", template = "value === 0 ? '已报名':'取消报名'")
    )
    private int status;

    @EruptField(
            views = @View(title = "报名时间")
    )
    private Date createTime;

    @EruptField(
            views = @View(title = "变更时间")
    )
    private Date updateTime;

}
